Context based access path selection

ABSTRACT

A computer-implemented method includes receiving a batch processing job. The method identifies multiple access paths for the batch processing job. The method determines one or more runtime costs for each of the multiple access paths. The method determines whether the batch processing job includes comparable access paths. The method responds to the batch processing job not including comparable access paths by receiving a query and selecting a desired access, based on the one or more runtime costs. The method responds to the batch processing job including comparable access paths by determining one or more context costs for each of the one or more access paths, receiving a query, identifying a context for the query, and selecting a desired access path for the query. The desired access path is based on the one or more runtime costs, the one or more context costs, and the context for the query.

BACKGROUND

The present invention relates generally to batch processes and inparticular to selecting access paths.

Batch processing is the execution of a series of programs on a computerwithout manual intervention. Structured Query Language (SQL) is aprogramming language for stream-processing in batch processes. SQL issubdivided into several language elements, including clauses,expressions, predicates, queries, and statements. A database managementsystem (DBMS) retrieves data based on criteria specified in a query. TheDBMS retrieves data for the query via an access path for the batchprocessing job. Some batch processing jobs include multiple possibleaccess paths that a DBMS might use to retrieve data. The DBMS may choosea particular access path based on the predicted runtime cost for eachpossible access path, favoring the fastest of the multiple access paths.Developers continue to face challenges with functions, methods, andsystems for selecting the query access path.

SUMMARY

A computer-implemented method includes receiving a batch processing job.The method identifies one or more access paths for the batch processingjob. The method determines one or more runtime costs. Each runtime costis for each of the one or more access paths. The method determineswhether the batch processing job includes comparable access paths. Themethod responds to the batch processing job not including comparableaccess paths. The method responds by receiving a query. The methodresponds by selecting a desired access path for the query. The desiredaccess path for the query is based on the one or more runtime costs. Themethod responds to the batch processing job including comparable accesspaths. The method responds by determining one or more context costs.Each of said one or more context costs is a context cost for each of theone or more access paths. The method responds by receiving a query. Themethod responds by identifying a context for the query. The methodresponds by selecting a desired access path for the query. The desiredaccess path for the query is based on the one or more runtime costs, theone or more context costs, and the context for the query. Acorresponding computer system and computer program product are alsodisclosed.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a block diagram of one embodiment of a computer systemenvironment suitable for operation in accordance with at least oneembodiment of the invention.

FIG. 2 is a flowchart depicting operational steps for an access pathselection program in accordance with at least one embodiment of theinvention.

FIG. 3 is a flowchart depicting operational steps for an access pathselection program that determines if a batch processing job hascomparable access paths based on a runtime comparison threshold inaccordance with at least one embodiment of the invention.

FIG. 4 is a block diagram of a computing apparatus suitable forexecuting the access path selection program in accordance with at leastone embodiment of the present invention.

DETAILED DESCRIPTION

Referring now to the invention in more detail, FIG. 1 is a block diagramdisplaying an exemplary computer system environment suitable foroperation of at least one embodiment of the invention. A computer system100 includes a batch processing job 110, an access paths 120A and 120B,a runtime costs 130A and 130B, a context costs 135A and 135B, a query140, a context 145, an access path selection program 150, and a selectedaccess path 160, all in mutual electronic communication andinterconnected within the computer system 100.

The access path selection program 150 may generate the selected accesspath 160 for use by the query 140 during the batch processing job 110.The batch processing job 110 includes one or more access paths such asthe access paths 120A and 120B. The access paths 120A and 120B areavailable to the query 140 as steps for the query 140 to perform toretrieve data. Each of the one or more access paths comprises a runtimecost such as the runtime costs 130A and 130B. Each of the one or moreaccess paths comprises a context cost such as the context costs 135A and135B.

The batch processing job 110 is a series of programs, tasks, or jobsperformed by the computer system 100. The series of programs, tasks, orjobs are programmed such that the computer system 100 can execute thebatch processing job 110 to completion without human interaction. Theseries of programs, tasks, or jobs may be expressed in Structured QueryLanguage (SQL). SQL includes clauses, expressions, predicates, queries,such as the query 140, and statements which enable the computer system100 to execute the batch processing job 110 to completion.

The query 140 is an element of SQL used by the computer system 100 toexecute the batch processing job 110. The query 140 is used to retrievedata. The query 140 retrieves data from one or more tables, one or moreexpressions, one or more indexes, or one or more databases. The query140 may retrieve data from different locations or combinations oflocations. Such differences result in the batch processing job 110comprising one or more access paths by which the query 140 may retrievedata. The query 140 comprises the context 145.

The context 145 is a set of data used by the computer system 100 toexecute the query 140. The context 145 comprises a set of metadataassociated with the set of data used by the computer system 100 toexecute the query 140. For example, the context 145 would comprise dataindicating whether the query 140 is executed in a batch loop. In someembodiments, the context 145 is based on an input data sequence for thequery 140 and comprises an identified order. For example, a query mayprompt the computer system 100 to select a set of values from a table Awhere a first column of the table A meets a first criteria and a secondcolumn of the table A meets a second criteria. In such an example, theinput data sequence comprises the identified order (first column oftable A, second column of table A). In such an example, the context 145would comprise data indicating whether the query 140 is executed in abatch loop. In embodiments where the query 140 is executed in a batchloop, the batch processing job may include two candidate access pathsfor the query 140. A first candidate access path follows the identifiedorder (first column of table A, second column of table A). A secondcandidate access path follows an order (second column of table A, firstcolumn of table A).

The access paths 120A and 120B are actions by which the computer system100 retrieves data from one or more tables, one or more expressions, oneor more indexes, or one or more databases. For example, the access paths120A and 120B may be full table scans, row ID scans, index scans,cluster access scans, or hash access scans. In general the access paths120A and 120B are steps the computer system 100 may take to execute thequery 140 as a part of the batch processing job 110.

Each of the access paths 120A and 120B correspond to the runtime costs130A and 130B, respectively. The access path selection program 150determines the runtime costs 130A and 130B. In general, the runtimecosts 130A and 130B are an execution time. The runtime costs 130A and130B are an amount of resources, such as time and storage, necessary toexecute the query 140. In some embodiments, the access path selectionprogram 150 determines the runtime costs 130A and 130B as a functionrelating a query 140 input length to a number of steps executed by thequery 140 and a data storage location for the data the query 140 promptsthe computer system 100 to retrieve. In some embodiments, the accesspath selection program 150 determines the runtime costs 130A and 130Busing a uniform cost model or a logarithmic cost model.

Each of the access paths 120A and 120B correspond to the context costs135A and 135B, respectively. The access path selection program 150determines the context costs 135A and 135B. In general, the contextcosts 135A and 135B consider how the context 145 may affect theexecution time of the query 140. In examples where the query 140 isexecuted in a batch loop, the access path selection program 150considers that the computer system 100 may execute multiple passes ofthe query 140 as a part of the number of steps executed by the query140. In such embodiments, the access path selection program 150 maydetermine the context costs 135A and 135B as a function by relating aquery 140 input length, a number of steps executed by the query 140, anda data storage location for the data the query 140 prompts the computersystem 100 to retrieve. In such embodiments, the number of steps, thedata storage location, and the query 140 input length include theiteration steps the computer system 100 takes when executing the query140 in a batch loop. In some embodiments, the access path selectionprogram 150 determines the context costs 135A and 135B using a uniformcost model or a logarithmic cost model. Each of the access paths 120Aand 120B may have additional corresponding context costs (not shown).For example, an access path may have a first context cost correspondingto the context 145 including that the query 140 is a single query and asecond context cost corresponding to the context 145 including that thequery 140 is executed in a batch job loop.

The selected access path 160 is one of the access paths 120A and 120B.The access path selection program 150 selects the selected access path160 between the access paths 120A and 120B by comparing the runtimecosts 130A and 130B and relevant context costs for each of the accesspaths 120A and 120B, the relevant context costs for each of the accesspaths 120A and 120B corresponding to the context 145. The runtime costs130A and 130B and the context costs 135A and 135B are lengths of time.The selected access path 160 corresponds to an access path associatedwith the shortest length of time. For example, if among runtime costs Aand B and context costs C and D, runtime cost A is the shortest lengthof time, the access path associated with runtime cost A will be theselected access path 160.

FIG. 2 is a flowchart depicting the operational steps of the access pathselection program 150 executing within the computer system of FIG. 1, inaccordance with an embodiment of the present invention.

At step 200, the access path selection program 150 receives the batchprocessing job 110. Receiving may include a user explicitly calling theaccess path selection program 150 from a command line interface using areference to the selected access path 160 as an argument. Alternatively,receiving may include automated calls to the access path selectionprogram 150, for example from an integrated development environment oras part of a batch process management system.

At step 202, the access path selection program 150 identifies one ormore access paths, such as the access paths 120A and 120B, which areavailable during the batch processing job 110, for each query for thebatch processing job 110. The access path selection program 150 performsthe step 202 by identifying one or more access paths. Selecting mayinclude a segment scan or an index scan. Selecting may include metadataabout a database the batch processing job 110 is referencing such asmetadata about tables, rows, and columns within the database and indexesassociated with data within the database.

At step 204, the access path selection program 150 determines runtimecosts, such as the runtime costs 130A and 130B, for each query. Theaccess path selection program 150 performs the step 204 by determiningone or more runtime costs. The access path selection program 150 acts todetermine one or more runtime costs. The access path selection program150 determines a runtime cost for each of the one or more access pathsidentified at the step 202. Determining runtime costs may include afunction relating the query input length to a number of steps within thequery and a data storage location for the data the query prompts thecomputer system 100 to retrieve. In some embodiments, the access pathselection program 150 determines the runtime costs 130A and 130B using auniform cost model or a logarithmic cost model.

At step 206, the access path selection program 150 determines if thebatch processing job 110 contains comparable runtime costs. The accesspath selection program 150 compares each runtime cost determined at thestep 204 for each query. Each runtime cost, such as the runtime costs130A and 130B, and the runtime costs determined at the step 204 is alength of time. The access path selection program 150 compares theruntime costs determined at the step 204 by comparing the length of timethat is each runtime cost. The access path selection program 150determines if the batch processing job 110 contains comparable runtimecosts based on a predetermined criterion.

For example, in some embodiments, the access path selection program 150will determine if the batch processing job 110 contains comparableruntime costs by determining whether said batch processing job includesone or more candidate query contexts. Determining may involve countingthe number of query contexts to determine if the batch processing job110 includes one or more candidate query contexts. For example, a batchprocessing job A contains query A. Query A can only be executed in abatch loop in the batch processing job A. In such an example, the accesspath selection program 150 will determine the batch processing job 110does not contain comparable runtime costs with respect to Query A. Theaccess path selection program 150 may count the number of candidatequery contexts associated with Query A. In such an example, the accesspath selection program 150 will determine that Query A has only onecandidate query context. The access path selection program 150 may countone or more candidate query contexts. The access path selection program150 counts only one candidate query contexts, determine the batchprocessing job 110 does not contain comparable runtime costs. The accesspath selection program 150 may count two or more candidate querycontexts, determine the batch processing job 110 does contain comparableruntime costs.

In another example the batch processing job A contains a Query B. QueryB can be executed as a single query or executed in a batch loop context.In such an example Query B may be executed in a for loop where undercertain conditions the Query B is executed in a single query context andunder other conditions the Query B is executed in a batch loop context.In such an example, the access path selection program 150 determinesthat the batch processing job 110 contains two or more candidate querycosts and is responsive by determining that the batch processing job 110contains comparable runtime costs. In such an embodiment, the accesspath selection program 150 may also identify two or more comparableaccess paths.

In another example the access path selection program 150 determines ifthe batch processing job 110 contains comparable access paths bycounting the number of access paths for the batch processing job 110.This is done by counting one or more candidate query contexts orcounting two or more candidate query contexts. In such an embodiment,the access path selection program 150 determines if the batch processingjob 110 contains only one access path or if the batch processing job 110contains two or more access paths. If the access path selection program150 determines that the batch processing job contains only one accesspath, the access path selection program 150 will complete the step 206by determining that the batch processing job 110 does not containcomparable access paths. The access path selection program 150 may countonly one access path, determine the batch processing job 110 does notcontain comparable access paths. The access path selection program 150may count two or more access paths, determine the batch processing job110 does contain comparable access paths. If the access path selectionprogram 150 determines that the batch processing job contains two ormore access paths, the access path selection program 150 will completethe step 206 by determining that the batch processing job 110 doescontain comparable access paths. In some embodiments, the access pathselection program 150 may determine if the batch processing job 110contains comparable access paths by counting the number of access pathsassociated with each query associated with the batch processing job 110.

In embodiments where the access path selection program 150 determinesthat the batch processing job 110 does not contain comparable accesspaths, the access path selection program 150 proceeds to step 210. Atthe step 210 the access path selection program 150 receives the query140. In some embodiments, the access path selection program 150 receivesthe query 140 during an execution time for the batch processing job 110.

At step 212, the access path selection program 150 selects an accesspath for the query 140 based on the runtime costs determined at the step204. The access path selected for the query 140 is the selected accesspath 160. In some embodiments, the access path selection program 150chooses the selected access path 160 based on execution time, with theselected access path 160 having the shortest execution time compared toother candidate access paths. In other embodiments, the selected accesspath 160 may be an only candidate access path for the query 140. Inother embodiments, the access path selection program 150 may choose theselected access path 160 based on a number of steps, with the selectaccess path 160 having the fewest number of steps when compared to othercandidate access paths.

In embodiments where the access path selection program 150 determinesthat the batch processing job 110 does contain comparable access paths,the access path selection program 150 proceeds to step 220. At the step220 the access path selection program 150 determines a context cost foreach comparable access path identified at the step 206. The access pathselection program 150 determines if any access paths for a query have acomparable cost to determine one or more context costs.

At step 222 the access path selection program 150 receives the query140. In some embodiments, the access path selection program 150 receivesthe query 140 during an execution time for the batch processing job 110.

At step 224 the access path selection program 150 identifies the context145. Identifying may include analyzing the SQL associated with the query140 to determine the context of the query 140. For example, the accesspath selection program 150 may analyze the SQL of a query and determinethe query 140 is executed in a batch loop. In such an example, theaccess path selection program 150 will determine that the context 145for the query 140 is that a batch loop context.

At step 226 the access path selection program 150 will select theselected access path 160. The access path selection program 150 mayselect the selected access path 160 by choosing between the two or morecomparable access paths that were identified during the step 206. Insome embodiments, the access path selection program 150 will choosebetween the two or more comparable access paths by selecting an accesspath that is one of the two or more comparable access paths based onwhich has a lower context cost, given the context 145 of the query 140.For example, a Query C has three possible access paths: access path X,access path Y, and access path Z. Access path X and access path Z arecomparable. Access path Z has a lower single query context cost. Accesspath X has a lower batch loop context cost. In such an example, if theaccess path selection program 150 determines that the Query C has abatch loop context, Access path X will be the selected access path 160.If the access path selection program 150 determines that the Query C hasa single query context, Access path Z will be the selected access path160.

In some embodiments, the access path selection program 150 determines,at bind time, a query dependency structure and selects, at executiontime, the selected access path 160. The query dependency structure is adesired access path for each query in a given context. At bind time, theaccess path selection program 150 may determine runtime costs andcontext costs for each query. At execution time, the access pathselection program 150 may select the selected access path 160 based onthe query dependency structure determined at execution time.

FIG. 3 is a flowchart depicting the operational steps of the access pathselection program 150 executing with the computer system of FIG. 1, inaccordance with an embodiment of the present invention where the accesspath selection program 150 determines if the batch processing job 110includes comparable access paths is based on a runtime comparisonthreshold.

The access path selection program 150 performs step 300, step 302, andstep 304 in a way that is similar to the embodiment depicted in FIG. 2.

At step 306 the access path selection program 150 receives a runtimecomparison threshold. The runtime comparison threshold is apre-determined value that corresponds to a numerical difference inexecution time amongst various runtime costs that were determined at thestep 304. In some embodiments the runtime comparison threshold is adifference in time or a numerical difference in runtime. In otherembodiments the runtime comparison threshold is a measure of resourcerequired by the computer system 100 to use an access path.

At step 308 the access path selection program 150 determines if thebatch processing job has comparable access paths or if no such accesspaths exist. The access path selection program 150 uses the runtimecomparison threshold to make this comparison. For example, the runtimecomparison threshold may be thirty seconds. A batch processing jobcontains access paths G and access path H for a Query E. A runtime costfor the access path G may be forty-five seconds. A runtime cost for theaccess path H may be one minute. In such an embodiment, the access pathselection program 150 will determine that the difference between accesspath G and access path H is below the runtime comparison threshold anddetermine that the batch processing job does have comparable accesspaths for the Query E.

The access path selection program 150 performs step 310, step 312, step320, step 322, step 324, and step 326 in a way that is similar to theembodiment depicted in FIG. 2.

FIG. 4 is a block diagram depicting components of a computer 400suitable for executing the access path selection program 150. FIG. 4displays the computer 400, the one or more computer processor(s) 404(including one or more computer processors), the communications fabric402, the memory 406, the RAM 416, the cache 418, the persistent storage408, the communications unit 410, the I/O interface(s) 412, the display420, and the external devices 418. It should be appreciated that FIG. 4provides only an illustration of one embodiment and does not imply anylimitations with regard to the environments in which differentembodiments may be implemented. Many modifications to the depictedenvironment may be made.

As depicted, the computer 400 operates over a communications fabric 402,which provides communications between the cache 418, the computerprocessor(s) 404, the memory 406, the persistent storage 408, thecommunications unit 410, and the input/output (I/O) interface(s) 412.The communications fabric 402 may be implemented with any architecturesuitable for passing data and/or control information between thecomputer processor(s) 404 (e.g. microprocessors, communicationsprocessors, and network processors, etc.), the memory 406, the externaldevices 418, and any other hardware components within a system. Forexample, the communications fabric 402 may be implemented with one ormore buses or a crossbar switch.

The memory 406 and persistent storage 408 are computer readable storagemedia. In the depicted embodiment, the memory 406 includes a randomaccess memory (RAM). In general, the memory 406 may include any suitablevolatile or non-volatile implementations of one or more computerreadable storage media. The cache 418 is a fast memory that enhances theperformance of computer processor(s) 404 by holding recently accesseddata, and data near accessed data, from memory 406.

Program instructions for the access path selection program 150 may bestored in the persistent storage 408 or in memory 406, or moregenerally, any computer readable storage media, for execution by one ormore of the respective computer processor(s) 404 via the cache 418. Thepersistent storage 408 may include a magnetic hard disk drive.Alternatively, or in addition to a magnetic hard disk drive, thepersistent storage 408 may include, a solid state hard disk drive, asemiconductor storage device, read-only memory (ROM), electronicallyerasable programmable read-only memory (EEPROM), flash memory, or anyother computer readable storage media that is capable of storing programinstructions or digital information.

The media used by the persistent storage 408 may also be removable. Forexample, a removable hard drive may be used for persistent storage 408.Other examples include optical and magnetic disks, thumb drives, andsmart cards that are inserted into a drive for transfer onto anothercomputer readable storage medium that is also part of the persistentstorage 408.

The communications unit 410, in these examples, provides forcommunications with other data processing systems or devices. In theseexamples, the communications unit 410 may include one or more networkinterface cards. The communications unit 410 may provide communicationsthrough the use of either or both physical and wireless communicationslinks. The access path selection program 150 may be downloaded to thepersistent storage 408 through the communications unit 410. In someembodiments of the present invention, the source of the various inputdata may be physically remote to the computer 400 such that the inputdata may be received and the output similarly transmitted via thecommunications unit 410.

The I/O interface(s) 412 allows for input and output of data with otherdevices that may operate in conjunction with the computer 400. Forexample, the I/O interface(s) 412 may provide a connection to theexternal devices 418, which may include a keyboard, keypad, a touchscreen, and/or some other suitable input devices. External devices 418may also include portable computer readable storage media, for example,thumb drives, portable optical or magnetic disks, and memory cards.Software and data used to practice embodiments of the present inventionmay be stored on such portable computer readable storage media and maybe loaded onto the persistent storage 408 via the I/O interface(s) 412.The I/O interface(s) 412 may similarly connect to a display 420. Thedisplay 420 provides a mechanism to display data to a user and may be,for example, a computer monitor.

The programs described herein are identified based upon the applicationfor which they are implemented in a specific embodiment of theinvention. However, it should be appreciated that any particular programnomenclature herein is used merely for convenience, and thus theinvention should not be limited to use solely in any specificapplication identified and/or implied by such nomenclature.

The present invention may be a system, a method, and/or a computerprogram product at any possible technical detail level of integration.The computer program product may include a computer readable storagemedium (or media) having computer readable program instructions thereonfor causing a processor to carry out aspects of the present invention.

The computer readable storage medium can be a tangible device that canretain and store instructions for use by an instruction executiondevice. The computer readable storage medium may be, for example, but isnot limited to, an electronic storage device, a magnetic storage device,an optical storage device, an electromagnetic storage device, asemiconductor storage device, or any suitable combination of theforegoing. A non-exhaustive list of more specific examples of thecomputer readable storage medium includes the following: a portablecomputer diskette, a hard disk, a random access memory (RAM), aread-only memory (ROM), an erasable programmable read-only memory (EPROMor Flash memory), a static random access memory (SRAM), a portablecompact disc read-only memory (CD-ROM), a digital versatile disk (DVD),a memory stick, a floppy disk, a mechanically encoded device such aspunch-cards or raised structures in a groove having instructionsrecorded thereon, and any suitable combination of the foregoing. Acomputer readable storage medium, as used herein, is not to be construedas being transitory signals per se, such as radio waves or other freelypropagating electromagnetic waves, electromagnetic waves propagatingthrough a waveguide or other transmission media (e.g., light pulsespassing through a fiber-optic cable), or electrical signals transmittedthrough a wire.

Computer readable program instructions described herein can bedownloaded to respective computing/processing devices from a computerreadable storage medium or to an external computer or external storagedevice via a network, for example, the Internet, a local area network, awide area network and/or a wireless network. The network may comprisecopper transmission cables, optical transmission fibers, wirelesstransmission, routers, firewalls, switches, gateway computers and/oredge servers. A network adapter card or network interface in eachcomputing/processing device receives computer readable programinstructions from the network and forwards the computer readable programinstructions for storage in a computer readable storage medium withinthe respective computing/processing device.

Computer readable program instructions for carrying out operations ofthe present invention may be assembler instructions,instruction-set-architecture (ISA) instructions, machine instructions,machine dependent instructions, microcode, firmware instructions,state-setting data, configuration data for integrated circuitry, oreither source code or object code written in any combination of one ormore programming languages, including an object oriented programminglanguage such as Smalltalk, C++, or the like, and procedural programminglanguages, such as the “C” programming language or similar programminglanguages. The computer readable program instructions may executeentirely on the user's computer, partly on the user's computer, as astand-alone software package, partly on the user's computer and partlyon a remote computer or entirely on the remote computer or server. Inthe latter scenario, the remote computer may be connected to the user'scomputer through any type of network, including a local area network(LAN) or a wide area network (WAN), or the connection may be made to anexternal computer (for example, through the Internet using an InternetService Provider). In some embodiments, electronic circuitry including,for example, programmable logic circuitry, field-programmable gatearrays (FPGA), or programmable logic arrays (PLA) may execute thecomputer readable program instructions by utilizing state information ofthe computer readable program instructions to personalize the electroniccircuitry, in order to perform aspects of the present invention.

In some embodiments, the access path selection program 150 is anyprogram, list, database, or any other system capable of receiving thebatch processing job 110 and the query 140. The access path selectionprogram 150 may be a dedicated client DBMS program, a functionintegrated within another program, or any program or function that cancommunicate with the batch processing job 110 and the query 140, andprovide the selected access path 160.

Aspects of the present invention are described herein with reference toflowchart illustrations and/or block diagrams of methods, apparatus(systems), and computer program products according to embodiments of theinvention. It will be understood that each block of the flowchartillustrations and/or block diagrams, and combinations of blocks in theflowchart illustrations and/or block diagrams, can be implemented bycomputer readable program instructions.

These computer readable program instructions may be provided to aprocessor of a general purpose computer, special purpose computer, orother programmable data processing apparatus to produce a machine, suchthat the instructions, which execute via the processor of the computeror other programmable data processing apparatus, create means forimplementing the functions/acts specified in the flowchart and/or blockdiagram block or blocks. These computer readable program instructionsmay also be stored in a computer readable storage medium that can directa computer, a programmable data processing apparatus, and/or otherdevices to function in a particular manner, such that the computerreadable storage medium having instructions stored therein comprises anarticle of manufacture including instructions which implement aspects ofthe function/act specified in the flowchart and/or block diagram blockor blocks.

The computer readable program instructions may also be loaded onto acomputer, other programmable data processing apparatus, or other deviceto cause a series of operational steps to be performed on the computer,other programmable apparatus or other device to produce a computerimplemented process, such that the instructions which execute on thecomputer, other programmable apparatus, or other device implement thefunctions/acts specified in the flowchart and/or block diagram block orblocks.

The flowchart and block diagrams in the Figures illustrate thearchitecture, functionality, and operation of possible implementationsof systems, methods, and computer program products according to variousembodiments of the present invention. In this regard, each block in theflowchart or block diagrams may represent a module, segment, or portionof instructions, which comprises one or more executable instructions forimplementing the specified logical function(s). In some alternativeimplementations, the functions noted in the blocks may occur out of theorder noted in the Figures. For example, two blocks shown in successionmay, in fact, be executed substantially concurrently, or the blocks maysometimes be executed in the reverse order, depending upon thefunctionality involved. It will also be noted that each block of theblock diagrams and/or flowchart illustration, and combinations of blocksin the block diagrams and/or flowchart illustration, can be implementedby special purpose hardware-based systems that perform the specifiedfunctions or acts or carry out combinations of special purpose hardwareand computer instructions.

What is claimed is:
 1. A computer-implemented method comprising:receiving a batch processing job; identifying one or more access pathsfor said batch processing job; determining one or more runtime costs,each runtime cost being for each of said one or more access paths;determining whether said batch processing job comprises comparableaccess paths; and responsive to said batch processing job not comprisingcomparable access paths: receiving a query; selecting a desired accesspath for said query, said desired access path for said query being basedon said one or more runtime costs; and responsive to said batchprocessing job comprising comparable access paths: determining one ormore context costs, each of said one or more context costs being acontext cost for each of the one or more access paths; and receiving aquery; identifying, for said query, a query context; and selecting adesired access path for said query, said desired access path for saidquery being based on said one or more runtime costs, said one or morecontext costs, and said query context.
 2. The computer-implementedmethod of claim 1, wherein selecting a desired access path for saidquery comprises: determining, at bind time, a query dependencystructure, said query dependency structure being based on said one ormore runtime costs, said one or more context costs, and candidate querycontexts; and selecting, at execution time, a second desired access pathfor said query, said desired access path for said query being based onsaid query dependency structure and said query context.
 3. Thecomputer-implemented method of claim 1, wherein identifying a contextfor said query is based on an input data sequence for said querycomprising an identified order.
 4. The computer-implemented method ofclaim 1, wherein determining one or more context costs comprisesdetermining whether said batch processing job comprises one or morecandidate query contexts.
 5. The computer-implemented method of claim 4,wherein determining whether said batch processing job comprisescomparable access paths comprises: counting one or more candidate querycontexts; and responsive to said batch processing job comprising two ormore candidate query contexts, determining that said batch processingjob comprises comparable access paths; responsive to said batchprocessing job comprising only one candidate query contexts, determiningthat said batch processing job does not comprise comparable accesspaths.
 6. The computer-implemented method of claim 1, whereindetermining whether said batch processing job comprises comparableaccess paths comprises: counting said one or more access paths;responsive to said batch processing job comprising only one access path,determining that said batch processing job does not comprise comparableaccess paths; and responsive to said batch processing job comprising twoor more access paths determining that said batch processing job doescomprise comparable access paths.
 7. The computer-implemented method ofclaim 1, wherein determining whether said batch processing job comprisescomparable access paths comprises: receiving a runtime comparisonthreshold, said runtime comparison threshold being a numericaldifference in runtime between each runtime cost of said one or moreruntime costs; determining whether any said runtime cost comprises acomparable cost, said comparable cost being based on said runtimecomparison threshold; and responsive to any said runtime cost comprisingsaid comparable cost: determining that said batch processing job doescomprise comparable access paths; and responsive to no said runtime costcomprising said comparable cost: determining that said batch processingjob does not comprise comparable access paths.
 8. A computer programproduct comprising: one or more computer readable storage media andprogram instructions stored on said one or more computer readablestorage media, said program instructions comprising instructions to:receive a batch processing job; identify one or more access paths, forsaid batch processing job; determine one or more runtime costs, eachruntime cost being for each of said one or more access paths; determinewhether said batch processing job comprises comparable access paths; andresponsive to said batch processing job not comprising comparable accesspaths: receive a query; select a desired access path for said query,said desired access path for said query being based on said one or moreruntime costs; and responsive to said batch processing job comprisingcomparable access paths: determine one or more context costs, each ofsaid one or more context costs being a context cost for each of the oneor more access paths; receive a query; identify, for said query, a querycontext; and select a desired access path for said query, said desiredaccess path for said query being based on said one or more runtimecosts, said one or more context costs, and said query context.
 9. Thecomputer program product of claim 8, wherein said instructions to selecta desired access path for said query comprise instructions to:determine, at bind time, a query dependency structure, said querydependency structure being based on said one or more runtime costs, saidone or more context costs, and candidate query contexts; and select, atexecution time, a second desired access path for said query, saiddesired access path for said query being based on said query dependencystructure and said query context.
 10. The computer program product ofclaim 8, wherein said instructions to identify a context for said queryare based on an input data sequence for said query comprising anidentified order.
 11. The computer program product of claim 8, whereinsaid instructions to determine one or more context costs compriseinstructions to determine whether said batch processing job comprisesone or more candidate query contexts.
 12. The computer program productof claim 11, wherein said instructions to determine whether said batchprocessing job comprise comparable access paths comprise instructionsto: count one or more candidate query contexts; responsive to said batchprocessing job comprising two or more candidate query contexts,determine that said batch processing job comprises comparable accesspaths; and responsive to said batch processing job comprising only onecandidate query contexts, determine that said batch processing job doesnot comprise comparable access paths.
 13. The computer program productof claim 8, wherein said instructions to determine whether said batchprocessing job comprises comparable access paths comprise instructionsto: count said one or more access paths; responsive to said batchprocessing job comprising only one access path, determine that saidbatch processing job does not comprise comparable access paths; andresponsive to said batch processing job comprising two or more accesspaths, determine that said batch processing job does comprise comparableaccess paths.
 14. The computer program product of claim 8, wherein saidinstructions to determine whether said batch processing job comprisescomparable access paths comprise instructions to: receive a runtimecomparison threshold, said runtime comparison threshold being anumerical difference in runtime between each runtime cost of said one ormore runtime costs; determine whether any said runtime cost comprises acomparable cost, said comparable cost being based on said runtimecomparison threshold; and responsive to any said runtime cost comprisingsaid comparable cost: determine that said batch processing job doescomprise comparable access paths; and responsive to no said runtime costcomprising said comparable cost: determine that said batch processingjob does not comprise comparable access paths.
 15. A computer systemcomprising: one or more computer processors; one or more computerreadable storage media; computer program instructions; and said computerprogram instructions being stored on said computer readable storagemedia for execution by at least one of said one or more processors, saidcomputer program instructions comprising instructions to: receive abatch processing job; identify one or more access paths for said batchprocessing job; determine one or more runtime costs, each runtime costbeing for each of said one or more access paths; determine whether saidbatch processing job comprises comparable access paths; and responsiveto said batch processing job not comprising comparable access paths:receive a query; select a desired access path for said query, saiddesired access path for said query being based on said one or moreruntime costs; and responsive to said batch processing job comprisingcomparable access paths: determine one or more context costs, each ofsaid one or more context costs being a context cost for each of the oneor more access paths; receive a query; identify, for said query, a querycontext; and select a desired access path for said query, said desiredaccess path for said query being based on said one or more runtimecosts, said one or more context costs, and said query context.
 16. Thecomputer system of claim 15, wherein said instructions to select adesired access path for said query comprise instructions to: determine,at bind time, a query dependency structure, said query dependencystructure being based on said one or more runtime costs, said one ormore context costs, and candidate query contexts; and select, atexecution time, a second desired access path for said query, saiddesired access path for said query being based on said query dependencystructure and said query context.
 17. The computer system of claim 15,wherein said instructions to identify a context for said query are basedon an input data sequence for said query comprising an identified order.18. The computer system of claim 15, wherein said instructions todetermine one or more context costs comprise instructions to determinewhether said batch processing job comprises one or more candidate querycontexts.
 19. The computer system of claim 15, wherein said instructionsto determine whether said batch processing job comprises comparableaccess paths comprise instructions to: count said one or more accesspaths; responsive to said batch processing job comprising only oneaccess path; determine that said batch processing job does not comprisecomparable access paths; and responsive to said batch processing jobcomprising two or more access paths, determine that said batchprocessing job does comprise comparable access paths.
 20. The computersystem of claim 15, wherein said instructions to determine whether saidbatch processing job comprises comparable access paths compriseinstructions to: receive a runtime comparison threshold, said runtimecomparison threshold being a numerical difference in runtime betweeneach runtime cost of said one or more runtime costs; determine whetherany said runtime cost comprises a comparable cost, said comparable costbeing based on said runtime comparison threshold; and responsive to anysaid runtime cost comprising said comparable cost: determine that saidbatch processing job does comprise comparable access paths; andresponsive to no said runtime cost comprising said comparable cost:determine that said batch processing job does not comprise comparableaccess paths.